package com.shiguiwu.springmybatis.designpattern.dutychain.scene;

import cn.hutool.core.util.RandomUtil;
import lombok.extern.slf4j.Slf4j;

import javax.naming.Name;
import java.util.concurrent.TimeUnit;

/**
 * @description: 贾母
 * @author: stone
 * @date: Created by 2022/11/7 22:00
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.designpattern.dutychain.scene
 */
@Slf4j
public class ActPlayer extends Player{
    @Override
    public void handle() throws Exception {
        log.info("{} ，传花。。。。。。", this.name);
        TimeUnit.SECONDS.sleep(RandomUtil.randomInt(0,3));

        if (isStop) {
            log.error("{},行酒令开始 -----------", this.name);
            TimeUnit.SECONDS.sleep(RandomUtil.randomInt(1,3));
            isStop = false;
            next();
        }
        else {
            next();
        }
    }


    public ActPlayer(String name, Player next) {
        super(name, next);
    }

    public ActPlayer(String name) {
        super(name);
    }
}
